package com.bwie.publish.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.Query;

import com.bwie.publish.dao.HousingRingDao;
import com.bwie.publish.entity.HousingRingEntity;
import com.bwie.publish.service.HousingRingService;


@Service("housingRingService")
public class HousingRingServiceImpl extends ServiceImpl<HousingRingDao, HousingRingEntity> implements HousingRingService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<HousingRingEntity> wrapper = new QueryWrapper<>();

        String housingRingName = (String) params.get("housingRingName");

        if (StringUtils.isNotEmpty(housingRingName)){
            wrapper.eq("housing_ring_name",housingRingName);
        }

        IPage<HousingRingEntity> page = this.page(
                new Query<HousingRingEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}